
	package com.example.demo.controller;
	import org.springframework.beans.factory.annotation.Autowired;
	import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.example.demo.entity.User;
	import com.example.demo.service.UserLoginService;

	@Controller
	@RequestMapping("/UserLogin")
	public class UserLoginController {
		
		@Autowired
	private UserLoginService userService;
		
		
	public String UserLogin(@RequestParam("username") String username,
			@RequestParam("password") String password,
			@RequestParam("checkpassword") String checkpassword,Model model){
			
		User user=new User();
		if(username!=null&&password!=null&&checkpassword==password) {
			user.setusername(username);
			user.setpassword(checkpassword);
			userService.Login(username, checkpassword);
		}
		else
		{
			model.addAttribute("msg","输入不合法");
					return "login";
		}
		return "index";
	}
	}
	

